<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>My JSP 'yunba.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript" src="js/socket.io-1.3.5.min.js"></script>
	<script type="text/javascript" src="js/yunba-js-sdk.js"></script>
	<script type="text/javascript">
		var yunba = new Yunba({server: 'http://sock.yunba.io', port: 3000, appkey: "58d9c776691ac9095323544a"});
		yunba.init(function (success) {
    		if (success) {
        			yunba.connect_by_customid('your_app_user_id', function (success, msg, sessionid) {
	            if (success) {
	                console.log('你已成功连接到消息服务器，会话ID：' + sessionid);
	                	yunba.subscribe({'topic': 'topic1'}, 
				    	function (success, msg) {
					        if (success) {
					            console.log('你已成功订阅频道：topic1');
					        } else {
					            console.log(msg);
					        }
				    	}
				);
            } else {
                console.log(msg);
            }
        });
    }
});
		//监听消息接收
		yunba.set_message_cb(function (data) {
	    console.log('Topic:' + data.topic + ',Msg:' + data.msg);
		    if(data.msg='abc'){
		    	window.location.href="<%=path%>/uploadfile/selectAll";
		 } 	    	    
});
	</script>
  </head>
  <body>
    This is my JSP page. <br>
  </body>
</html>
